#!/bin/bash
if ! command -v go &> /dev/null; then
    echo "开始下载 Go 1.18"
    arch=$(uname -m)
    if [[ $arch == "x86_64" ]]; then
    # 下载 x86_64 架构的 Go 安装包
       wget http://10.75.2.14:8089//group1/default/20230513/15/48/2/go1.18.linux-amd64.tar.gz
    elif [[ $arch == "armv7l" || $arch == "aarch64" ]]; then
    # 下载 ARM 架构的 Go 安装包
       wget http://10.75.2.14:8089//group1/default/20230513/15/48/2/go1.18.10.linux-arm64.tar.gz
    else
       echo "不支持的架构：$arch"
    exit 1
    fi
    echo "Go 下载完成"
    echo "开始解压 Go 1.18"
    sudo tar -C /usr/local -xzf go1.18*.tar.gz
    echo "Go 解压完成"
    echo "开始更新环境变量"
    sudo sh -c 'echo "export PATH=\$PATH:/usr/local/go/bin" >> /etc/profile'
    sleep 5
    source /etc/profile
    source ~/.bashrc   # 加载 .bashrc 文件中的环境变量
    echo "环境变量更新成功"
    source /etc/profile
if [ "$(go version | awk '{print $3}')" = "go1.18" ]; then
  echo "安装成功"
else
  echo "安装失败"
  exit 1
fi
    echo "Go 环境安装完成"
else
    echo "发现 Go 环境，跳过安装"
fi
echo "开始设置句柄数"
echo "* soft nofile 204800" >> /etc/security/limits.conf
echo "* hard nofile 204800" >> /etc/security/limits.conf
echo "* soft nproc 204800" >> /etc/security/limits.conf
echo "* hard nproc 204800" >> /etc/security/limits.conf
ulimit -n 204800
ulimit -u 204800

# 检查文件句柄数限制和进程数限制是否设置成功
if grep -q "204800" /etc/security/limits.conf && ulimit -n | grep -q "204800" && ulimit -u | grep -q "204800"; then
    echo "句柄数限制设置成功！"
else
    echo "句柄数限制设置失败！"
fi

# 判断目录 /home/www 是否存在，存在则删除
if [ -d /home/www ]; then
    echo "目录 /home/www 已存在，删除该目录"
    rm -rf /home/www
fi

echo "开始创建目录 /home/www"
mkdir /home/www
echo "创建目录 /home/www 完成"

echo "切换到 /home/www 目录"
cd /home/www

echo "开始创建 any_api_server.go 文件并写入代码"
cat << 'EOF' > any_api_server.go
package main

import (
    "github.com/gin-gonic/gin"
    "math/rand"
)

type Data struct {
    Name                string
    EnglishName         string
    NicknameCn         string
    NicknameEn          string
    IDCardNumber        string
    PhoneNumber        string
    QQNumber            string
    Email               string
    NonMainstreamQQName string
    BankCardNumber      string
    CreditCardNumber    string
    LandlineNumber      string
    ProvinceCityArea    string
    Address             string
    LongitudeLatitude   string
    ElementarySchool    string
    MiddleSchool        string
    University          string
    Major               string
    Company             string
    Department          string
    LicensePlateNumber  string
    Ethnicity           string
    PhoneModel          string
    UnifiedSocialCreditCode string
    StrongPassword      string
}

func randomPath(c *gin.Context) {
    jsonData := []Data{
        {"Name":"米瑾茗","EnglishName":"Joshua Mciver","NicknameCn":"兆佩正宗祚思","NicknameEn":"yBWY5","IDCardNumber":"652302201407064296","PhoneNumber":"13713810283","QQNumber":"1981251515","Email":"t0hfjlt47@163.com","NonMainstreamQQName":"风过无痕","BankCardNumber":"6292970265316383845","CreditCardNumber":"6290823575259198","LandlineNumber":"0769-93979161","ProvinceCityArea":"辽宁省鞍山市台安县","Address":"黑龙江省齐齐哈尔市龙江县洋兴乡阳汇村里上组27号","LongitudeLatitude":"95.14586046911366,23.382196164419668","ElementarySchool":"承德市第九小学","MiddleSchool":"阿坝藏族羌族自治州第四中学","University":"宿迁学院","Major":"水利工程","Company":"律直代服务有限责任公司","DEPARTMENT":"财务部","LICENSEPLATENUMBER":"新A191Z6","Ethnicity":"黎族","PhoneModel":"vivo X27","UNIFIEDSOCIALCREDITCODE":"91533102D2CQE9FMK0","STRONGPASSWORD":"R&hwv4(CHG5Z29yi"},
        {"Name":"郦洁","EnglishName":"Orville Gieseke","NicknameCn":"山泽振","NicknameEn":"bIlvu","IDCardNumber":"140429196508067912","PhoneNumber":"14770964943","QQNumber":"15769464982","Email":"josht4@163.com","NonMainstreamQQName":"你眼里的雾","BankCardNumber":"6292983669289227589","CreditCardNumber":"6290551088589088","LandlineNumber":"0752-67964380","ProvinceCityArea":"河北省邯郸市邯山区","Address":"湖南省邵阳市绥宁县玉红乡汇正村尚土组65号","LongitudeLatitude":"98.2880738726982,36.369247971865896","ElementarySchool":"沈阳市第九小学","MiddleSchool":"毕节市第四中学","University":"大连海事大学","Major":"光学工程","Company":"裴盎弃允辨哀商贸股份有限公司","DEPARTMENT":"质量管理部","LICENSEPLATENUMBER":"鄂Y7A609","Ethnicity":"维吾尔族","PhoneModel":"索尼Xperia 1 II","UNIFIEDSOCIALCREDITCODE":"91650104RT523M6FB3","STRONGPASSWORD":"oOYfck@N6Pn)_09M"},
        {"Name":"奚毓","EnglishName":"Geneva Raysor","NicknameCn":"蕊琰纨丽洁宇毓","NicknameEn":"TZLk","IDCardNumber":"130224200102221910","PhoneNumber":"14707609916","QQNumber":"5123637364","Email":"ic9sboue@163.com","NonMainstreamQQName":"｛襟上花","BankCardNumber":"6297521063912178203","CreditCardNumber":"6298904746822841","LandlineNumber":"0756-39646812","ProvinceCityArea":"江西省九江市彭泽县","Address":"河北省唐山市丰润区民金中路63号莱茵欣园2栋2单元0804房","LongitudeLatitude":"76.19576394317973,7.343780810493701","ElementarySchool":"肇庆市第一小学","MiddleSchool":"抚州市第六中学","University":"新疆大学","Major":"动物遗传育种与繁殖","Company":"皑壁咨询有限责任公司","DEPARTMENT":"国际部","LICENSEPLATENUMBER":"苏J61038","Ethnicity":"傣族","PhoneModel":"vivo NEX 3","UNIFIEDSOCIALCREDITCODE":"91330127CB36NWKAD6","STRONGPASSWORD":"77*LacZLPOb4l*4r"},
        {"Name":"祁骆","EnglishName":"Ferdinand Wattley","NicknameCn":"景成修鸿强","NicknameEn":"R2vRn4N","IDCardNumber":"51118119420125449X","PhoneNumber":"14796684792","QQNumber":"91365044430","Email":"vlwldhilw@163.com","NonMainstreamQQName":"风里有情诗","BankCardNumber":"6296777382965248108","CreditCardNumber":"6290957181633238","LandlineNumber":"020-98136880","ProvinceCityArea":"山西省吕梁市汾阳市","Address":"四川省甘孜藏族自治州乡城县香天镇池沙村滨宝组48号","LongitudeLatitude":"111.1349654315274,35.47779566757361","ElementarySchool":"长春市第二小学","MiddleSchool":"海西蒙古族藏族自治州第八中学","University":"上海工程技术大学","Major":"中医基础理论","Company":"畏币岛摹布教育有限责任公司","DEPARTMENT":"企划部","LICENSEPLATENUMBER":"吉B339D4","Ethnicity":"黎族","PhoneModel":"努比亚Z20","UNIFIEDSOCIALCREDITCODE":"91320803M1T6CYEUK2","STRONGPASSWORD":"X2o%K@LyFa14kUb"},
        {"Name":"伍泉","EnglishName":"Madelene Ghee","NicknameCn":"恒南鹏峰金","NicknameEn":"dEr9V4r","IDCardNumber":"440404193305032891","PhoneNumber":"13105588753","QQNumber":"23343620154","Email":"ojzec3ryx@163.com","NonMainstreamQQName":"懒风荡秋千","BankCardNumber":"6297446905627893140","CreditCardNumber":"6296158683788190","LandlineNumber":"0759-28988566","ProvinceCityArea":"吉林省白城市通榆县","Address":"山西省忻州市保德县回福乡进八村向古组32号","LongitudeLatitude":"113.32902085167491,39.83065250348413","ElementarySchool":"黄冈市第十小学","MiddleSchool":"洛阳市第九中学","University":"河北中医学院","Major":"理论经济学","Company":"疫汐嘛侯投资有限责任公司","DEPARTMENT":"人力资源部","LICENSEPLATENUMBER":"湘CW6452","Ethnicity":"鄂温克族","PhoneModel":"荣耀20S","UNIFIEDSOCIALCREDITCODE":"91431103JYNL97T040","STRONGPASSWORD":"4sWCP*3asXZjh16"},
        {"Name":"邰泽厚","EnglishName":"Shae Wimpey","NicknameCn":"艳愉瑞园","NicknameEn":"Io2Ixuhi","IDCardNumber":"441223193910224014","PhoneNumber":"15101148966","QQNumber":"44163320279","Email":"udo@163.com","NonMainstreamQQName":"吹皱一池春水","BankCardNumber":"6295445110181944687","CreditCardNumber":"6291476377904146","LandlineNumber":"0768-41034143","ProvinceCityArea":"甘肃省白银市平川区","Address":"河南省信阳市商城县白安镇亭塘村古格组2号","LongitudeLatitude":"83.25305281369234,30.196731485589055","ElementarySchool":"滨州市第八小学","MiddleSchool":"朝阳市第六中学","University":"菏泽学院","Major":"病理学与病理生理学","Company":"帧冻幸毯厄鱼工程有限责任公司","DEPARTMENT":"产品部","LICENSEPLATENUMBER":"蒙M0C37C","Ethnicity":"汉族","PhoneModel":"vivo Y51s","UNIFIEDSOCIALCREDITCODE":"91430104J4957Q8AB3","STRONGPASSWORD":"Zl&Z73fF*Pq(mlV`"},
        {"Name":"翁奇元","EnglishName":"Pia Dudzik","NicknameCn":"州迪高钢弘","NicknameEn":"cjWa8wIV","IDCardNumber":"411081198801136533","PhoneNumber":"15991359196","QQNumber":"30774868663","Email":"z5sadwykw@163.com","NonMainstreamQQName":"∝\u0001\u0001⒎色花╯＊°","BankCardNumber":"6290747870516323750","CreditCardNumber":"6294527264112198","LandlineNumber":"0663-51280439","ProvinceCityArea":"江西省赣州市定南县","Address":"贵州省黔西南布依族苗族自治州兴义市德汇北路623号四季庭院北1栋1单元1703房","LongitudeLatitude":"90.91073630188741,31.17461156565881","ElementarySchool":"怀化市第九小学","MiddleSchool":"赤峰市第九中学","University":"西北民族大学","Major":"高分子化学与物理","Company":"勋殿便置业股份有限公司","DEPARTMENT":"财务部","LICENSEPLATENUMBER":"浙C48Z72","Ethnicity":"满族","PhoneModel":"OPPO A92s","UNIFIEDSOCIALCREDITCODE":"91640521NJ307A5FB0","STRONGPASSWORD":"wpE6*7qEYaQ0Ze4."},
        {"Name":"余慧伊","EnglishName":"Milly Lenczyk","NicknameCn":"朝宙文迪春","NicknameEn":"Br6Jjhc","IDCardNumber":"411422201010220137","PhoneNumber":"15824234561","QQNumber":"60765431589","Email":"dvwbxmxm@163.com","NonMainstreamQQName":"鳄鱼的眼泪","BankCardNumber":"6290375373497521608","CreditCardNumber":"6290339422410785","LandlineNumber":"0753-95258247","ProvinceCityArea":"广西壮族自治区桂林市秀峰区","Address":"广东省清远市连山壮族瑶族自治县永八镇发林村翔南组7号","LongitudeLatitude":"114.27200747860748,4.551712430855544","ElementarySchool":"西宁市第二小学","MiddleSchool":"咸阳市第三中学","University":"湖北师范大学文理学院","Major":"药物分析学","Company":"呸睁教育股份有限公司","DEPARTMENT":"国际部","LICENSEPLATENUMBER":"沪F13487","Ethnicity":"柯尔克孜族","PhoneModel":"华为Mate X","UNIFIEDSOCIALCREDITCODE":"91371082Q8ACU013J5","STRONGPASSWORD":"qIp9Xq1J02La%!Cv"},
        {"Name":"仝道","EnglishName":"Rosamond Morkert","NicknameCn":"松克景大礼清伯孺","NicknameEn":"yiwc64MJ","IDCardNumber":"653100197306041018","PhoneNumber":"13095485617","QQNumber":"69984734925","Email":"kduehzv@163.com","NonMainstreamQQName":"♀聼情ɡe薈yan荭ヤ","BankCardNumber":"6291645107430105968","CreditCardNumber":"6297988544306173","LandlineNumber":"0762-30761715","ProvinceCityArea":"广西壮族自治区柳州市柳北区","Address":"河北省张家口市桥东区林江西路994号佳境星城19栋2单元0802房","LongitudeLatitude":"79.96974461712745,19.44496809112513","ElementarySchool":"阿拉善盟第四小学","MiddleSchool":"鸡西市第九中学","University":"新疆农业大学","Major":"经济史","Company":"皖灵投资股份有限公司","DEPARTMENT":"产品部","LICENSEPLATENUMBER":"黑J153YF","Ethnicity":"怒族","PhoneModel":"荣耀X10 Max","UNIFIEDSOCIALCREDITCODE":"91411330N68CF1XW56","STRONGPASSWORD":"VurF&2$YEo&xl&S5"},
        {"Name":"孔芝","EnglishName":"Kenna Sumida","NicknameCn":"远俊彦培","NicknameEn":"Nxx5b","IDCardNumber":"210200195306027533","PhoneNumber":"15460406452","QQNumber":"97027952268","Email":"p07g@163.com","NonMainstreamQQName":"(_追逐夢想的孩子","BankCardNumber":"6297316146427805003","CreditCardNumber":"6293670660749402","LandlineNumber":"0662-31598938","ProvinceCityArea":"辽宁省沈阳市皇姑区","Address":"山西省忻州市宁武县池天镇常格村土桥组61号","LongitudeLatitude":"100.20176374734912,37.61527504099114","ElementarySchool":"喀什地区第四小学","MiddleSchool":"包头市第五中学","University":"福建江夏学院","Major":"皮肤病与性病学","Company":"柒躬捎捞文化传播股份有限公司","DEPARTMENT":"工程部","LICENSEPLATENUMBER":"吉M37838","Ethnicity":"傈僳族","PhoneModel":"努比亚红魔5S","UNIFIEDSOCIALCREDITCODE":"91360922H4QK01EJL4","STRONGPASSWORD":"E5m&V3,h&6OniYIn"},
        {"Name":"阎珍","EnglishName":"Virgil Kibbee","NicknameCn":"洋昌安育力飞南龙","NicknameEn":"z8iiZ","IDCardNumber":"632224199704011798","PhoneNumber":"19438409031","QQNumber":"58934237903","Email":"bsi5oqu@163.com","NonMainstreamQQName":"要学会坚强！","BankCardNumber":"6291827035990338689","CreditCardNumber":"6294880953529325","LandlineNumber":"0411-61351412","ProvinceCityArea":"江西省九江市九江县","Address":"甘肃省平凉市崇信县塘土乡宁里村湖栖组69号","LongitudeLatitude":"119.45245314279978,40.93079954910803","ElementarySchool":"太原市第四小学","MiddleSchool":"株洲市第六中学","University":"同济大学","Major":"工程热物理","Company":"拜块嫉腮递服务股份有限公司","DEPARTMENT":"企划部","LICENSEPLATENUMBER":"辽ZE753F","Ethnicity":"土族","PhoneModel":"ROG 游戏手机2精英版","UNIFIEDSOCIALCREDITCODE":"91451022LT3X8D9CY6","STRONGPASSWORD":"_WVDymT.8fuY2o8"},
        {"Name":"官厚鹏","EnglishName":"Evonne Hauxwell","NicknameCn":"萍华琼悦","NicknameEn":"S8W7","IDCardNumber":"141000198209273316","PhoneNumber":"16883672264","QQNumber":"11820181702","Email":"f0pfex@163.com","NonMainstreamQQName":"╬═☆爺ぁ低調單純ル","BankCardNumber":"6291024018405231815","CreditCardNumber":"6299723485466043","LandlineNumber":"0757-74218393","ProvinceCityArea":"河北省保定市曲阳县","Address":"广西壮族自治区来宾市象州县凤济乡华光村林永组49号","LongitudeLatitude":"78.04552503729192,41.575423748247324","ElementarySchool":"聊城市第八小学","MiddleSchool":"铜仁市第九中学","University":"南京信息工程大学滨江学院","Major":"逻辑学","Company":"瑚秃唱夫科技股份有限公司","DEPARTMENT":"总务部","LICENSEPLATENUMBER":"浙DW6847","Ethnicity":"锡伯族","PhoneModel":"中兴AXON 11 SE","UNIFIEDSOCIALCREDITCODE":"915425251BF594MER5","STRONGPASSWORD":"2Okj@WJh9!9m8AwQ"},
        {"Name":"全逸","EnglishName":"Andera Rezendes","NicknameCn":"颖娴妮枝奕","NicknameEn":"dtsne6z","IDCardNumber":"45000020011228087X","PhoneNumber":"16701359157","QQNumber":"42712998086","Email":"6z6r8@163.com","NonMainstreamQQName":"我已伤痕累累","BankCardNumber":"6290998672315549056","CreditCardNumber":"6299932218045806","LandlineNumber":"0763-90730344","ProvinceCityArea":"河南省安阳市文峰区","Address":"湖北省黄石市下陆区兴清东路989号聚隆景苑6栋2单元0902房","LongitudeLatitude":"96.49888646595713,33.053105127527516","ElementarySchool":"渭南市第三小学","MiddleSchool":"昌平区第四中学","University":"浙江外国语学院","Major":"精密仪器及机械","Company":"烂泌栖实业有限责任公司","DEPARTMENT":"总经办","LICENSEPLATENUMBER":"新L19754","Ethnicity":"锡伯族","PhoneModel":"华为nova 5","UNIFIEDSOCIALCREDITCODE":"912327236UADX7KLP8","STRONGPASSWORD":"76b1KfQ,g4I$qROo"},
        {"Name":"果会宗","EnglishName":"Nathan Lallier","NicknameCn":"礼凯骏兆龙民楠会","NicknameEn":"cjT32RSs","IDCardNumber":"410203194608216411","PhoneNumber":"13183105800","QQNumber":"8121423124","Email":"usw@163.com","NonMainstreamQQName":"我很极端，不喜欢便讨厌","BankCardNumber":"6295632121537977118","CreditCardNumber":"6291659167912185","LandlineNumber":"0752-45151351","ProvinceCityArea":"安徽省淮南市大通区","Address":"江苏省泰州市姜堰区虎田中路709号金竹大厦南3栋2单元1601房","LongitudeLatitude":"107.17255167784997,26.37724070918037","ElementarySchool":"平顶山市第八小学","MiddleSchool":"昆明市第十中学","University":"上海中医药大学","Major":"桥梁与隧道工程","Company":"脱木案传媒股份有限公司","DEPARTMENT":"秘书室","LICENSEPLATENUMBER":"沪X17779","Ethnicity":"布朗族","PhoneModel":"小米9 透明尊享版","UNIFIEDSOCIALCREDITCODE":"91640202XLB3F1N8H5","STRONGPASSWORD":"qCkoBl.z82BS85E"},
        {"Name":"熊川钢","EnglishName":"Whitney Mcwells","NicknameCn":"阳彦顺瀚凯","NicknameEn":"glfLptS6","IDCardNumber":"513225199508023257","PhoneNumber":"16191936628","QQNumber":"38066500877","Email":"43puvlos@163.com","NonMainstreamQQName":"笙歌白云上","BankCardNumber":"6290812661451468563","CreditCardNumber":"6299010593388750","LandlineNumber":"0668-73051868","ProvinceCityArea":"海南省海口市秀英区","Address":"内蒙古自治区巴彦淖尔市磴口县城关镇安观村锦上组61号","LongitudeLatitude":"103.70122054313556,20.526475937208208","ElementarySchool":"莆田市第六小学","MiddleSchool":"曲靖市第二中学","University":"南京师范大学泰州学院","Major":"轻工技术与工程","Company":"裔留圃酪东仇投资有限责任公司","DEPARTMENT":"客户服务部","LICENSEPLATENUMBER":"吉UGS401","Ethnicity":"赫哲族","PhoneModel":"黑鲨游戏手机3","UNIFIEDSOCIALCREDITCODE":"91430981UHDY219FQ8","STRONGPASSWORD":"h!E0zHLWa&Uk5r"},
        {"Name":"皇甫宾","EnglishName":"Malisa Sweeden","NicknameCn":"宾彪书艺浩超","NicknameEn":"LGLYD","IDCardNumber":"410724199304062099","PhoneNumber":"17578055955","QQNumber":"33505907008","Email":"8l@163.com","NonMainstreamQQName":"柠萌小丸子ヾ(^。^*)","BankCardNumber":"6299254722961146598","CreditCardNumber":"6299722228866923","LandlineNumber":"0757-31864923","ProvinceCityArea":"新疆维吾尔自治区喀什地区喀什市","Address":"内蒙古自治区乌兰察布市丰镇市白宝中路780号天和别苑东9栋3单元0901房","LongitudeLatitude":"81.41197008419867,5.405211840360439","ElementarySchool":"玉溪市第九小学","MiddleSchool":"宁波市第二中学","University":"新疆大学科学技术学院","Major":"管理学","Company":"贼仗郡能糖科技有限责任公司","DEPARTMENT":"客户服务部","LICENSEPLATENUMBER":"粤D6M44R","Ethnicity":"仫佬族","PhoneModel":"vivo X27 Pro","UNIFIEDSOCIALCREDITCODE":"91141027T0XKHUNR50","STRONGPASSWORD":"Eq6IagA1t&)zNT*7"}, 
        {"Name":"罗艺娴","EnglishName":"Sabrina Emo","NicknameCn":"欣渊爱懿","NicknameEn":"CgtI","IDCardNumber":"140721195403167512","PhoneNumber":"14719059039","QQNumber":"65112835430","Email":"fx9eye7o@163.com","NonMainstreamQQName":"眼眶却抵抗","BankCardNumber":"6291310222509757823","CreditCardNumber":"6296178876695150","LandlineNumber":"0668-61433860","ProvinceCityArea":"山东省青岛市莱西市","Address":"贵州省黔南布依族苗族自治州平塘县宁平镇光泉村兰城组75号","LongitudeLatitude":"74.88327158626895,35.87727411937244","ElementarySchool":"黄石市第五小学","MiddleSchool":"新乡市第二中学","University":"浙江万里学院","Major":"历史学","Company":"蹄皮增您诌爵实业有限责任公司","DEPARTMENT":"秘书室","LICENSEPLATENUMBER":"冀G45B1V","Ethnicity":"高山族","PhoneModel":"三星GALAXY Note 10+","UNIFIEDSOCIALCREDITCODE":"91410322FL47J16YC1","STRONGPASSWORD":"QCnvCsk2(XNl371"},
        {"Name":"章朝","EnglishName":"Yajaira Furnas","NicknameCn":"媛菁丽荃荔莺凤","NicknameEn":"Qgm1yFNS","IDCardNumber":"620000195211275353","PhoneNumber":"19154802757","QQNumber":"60158198514","Email":"1a1m@163.com","NonMainstreamQQName":"饮尽盏中余温","BankCardNumber":"6296836815274574820","CreditCardNumber":"6290973731575704","LandlineNumber":"0769-12761174","ProvinceCityArea":"浙江省嘉兴市桐乡市","Address":"上海市青浦区田吉北路780号天和良园9栋2单元2202房","LongitudeLatitude":"79.33698613381986,49.14792892004798","ElementarySchool":"十堰市第九小学","MiddleSchool":"珠海市第二中学","University":"山东财经大学","Major":"社会医学与卫生事业管理","Company":"屑哉愉熬杯袁发展股份有限公司","DEPARTMENT":"质量管理部","LICENSEPLATENUMBER":"津Y4033W","Ethnicity":"拉祜族","PhoneModel":"8848 钛金手机M6私人订制","UNIFIEDSOCIALCREDITCODE":"91652327QGP4AT2LM9","STRONGPASSWORD":"e4mL)J9WBkxc8S8"},
        {"Name":"荷高","EnglishName":"Sadye Michaelsen","NicknameCn":"语俊","NicknameEn":"qCfV1gLI","IDCardNumber":"15062519580506485X","PhoneNumber":"19546096608","QQNumber":"44786988300","Email":"qu@163.com","NonMainstreamQQName":"◇﹏百合微瀾","BankCardNumber":"6295104908661868496","CreditCardNumber":"6294040381835188","LandlineNumber":"0769-71935304","ProvinceCityArea":"内蒙古自治区赤峰市松山区","Address":"新疆维吾尔自治区喀什地区莎车县万向乡莲康村原池组89号","LongitudeLatitude":"79.10696387897892,5.36389784754051","ElementarySchool":"定西市第九小学","MiddleSchool":"信阳市第六中学","University":"苏州大学文正学院","Major":"土地资源管理","Company":"秧循文化创意有限责任公司","DEPARTMENT":"研发部","LICENSEPLATENUMBER":"皖R91921","Ethnicity":"苗族","PhoneModel":"华为畅享20 Plus","UNIFIEDSOCIALCREDITCODE":"91522732XDP0J89WQ4","STRONGPASSWORD":"aHJ28N3pRdO)j$j"},
        {"Name":"成冰","EnglishName":"Rosemary Lipitz","NicknameCn":"翔泽元礼","NicknameEn":"dQ0kbj","IDCardNumber":"14022120220305683X","PhoneNumber":"18871276683","QQNumber":"78544081537","Email":"izge@163.com","NonMainstreamQQName":"倔强的梦想","BankCardNumber":"6295837610777777835","CreditCardNumber":"6293439069199977","LandlineNumber":"0763-76593265","ProvinceCityArea":"四川省阿坝藏族羌族自治州阿坝县","Address":"四川省宜宾市宜宾县源洋镇甘百村金河组55号","LongitudeLatitude":"90.08630751951969,50.696793772661245","ElementarySchool":"长治市第六小学","MiddleSchool":"安庆市第一中学","University":"湖州师范学院求真学院","Major":"计算机系统结构","Company":"花植霞服务有限责任公司","DEPARTMENT":"销售部","LICENSEPLATENUMBER":"藏N25263","Ethnicity":"羌族","PhoneModel":"Microsoft Surface Duo","UNIFIEDSOCIALCREDITCODE":"91451122A3Q5XTFEP0","STRONGPASSWORD":"8awGy2*UZziU(4F"},
    }
    c.JSON(200, gin.H{
        "message": jsonData[rand.Intn(len(jsonData))],
    })
}

func main() {
    r := gin.Default()
    r.GET("/*any", randomPath)
    r.POST("/*any", randomPath)
    r.DELETE("/*any", randomPath)
    r.PUT("/*any", randomPath)
    r.PATCH("/*any", randomPath)
    r.OPTIONS("/*any", randomPath)
    r.Run(":80")
}
EOF
echo "any_api_server.go 文件创建并写入代码完成"

echo "开始执行 go mod init api_server.go"
go mod init api_server.go
echo "go mod init api_server.go 执行完成"

echo "开始配置 GOPROXY 环境变量为 https://goproxy.cn"
go env -w GOPROXY=https://goproxy.cn
echo "GOPROXY 环境变量配置完成"

echo "开始安装依赖包 github.com/gin-gonic/gin"
go get -u github.com/gin-gonic/gin
while [ ! -f ~/go/pkg/mod/github.com/gin-gonic/gin*/go.mod ]; do sleep 1; done
echo "依赖包 github.com/gin-gonic/gin 安装完成"

echo "开始编译 any_api_server.go 程序"
go build -o any_api_server any_api_server.go
echo "编译 any_api_server.go 程序完成"
echo "检查端口 80 是否被占用"
if lsof -Pi :80 -sTCP:LISTEN -t >/dev/null ; then
    echo "端口 80 已被占用，杀掉占用该端口的进程"
    kill $(lsof -t -i:80)
    echo "占用端口 80 的进程已被杀掉"
fi

#!/bin/bash

# 输出正在安装服务文件的提示信息
echo "正在将api服务写进系统服务"

# 安装服务文件
cat <<EOF > /lib/systemd/system/any_api_service.service
[Unit]
Description=any_api_server service
After=network.target

[Service]
Type=simple
User=root
Restart=always
RestartSec=5
ExecStart=/home/www/any_api_server

[Install]
WantedBy=multi-user.target
EOF

# 输出正在重新加载 systemd 配置文件的提示信息
echo "正在重新加载 systemd 配置文件..."

# 重新加载 systemd 配置文件
systemctl daemon-reload

# 输出正在启动服务的提示信息
echo "正在启动服务..."

# 启动服务
systemctl start any_api_service

# 等待服务启动成功
while ! systemctl is-active --quiet any_api_service; do
    sleep 1
done

# 输出安装成功的提示信息
echo "any_api_service 服务安装成功！"

echo "启动 any_api_server 服务"
./any_api_server &
echo "any_api_server 服务已启动"
